# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-movie
epoch=1
pkgver=5.10.34
pkgrel=1
pkgdesc='Movie player based on mpv'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/deepin-movie-reborn"
license=('GPL3')
depends=('dtkcore' 'dtkgui' 'dtkwidget' 'qt5-base' 'qt5-svg' 'ffmpegthumbnailer' 'libxtst'
         'libglvnd' 'dconf' 'gsettings-qt' 'libva' 'libxcb' 'libx11' 'qt5-x11extras' 'mpv'
         'qt5-multimedia' 'qtdbusextended' 'qtmpris' 'deepin-daemon')
makedepends=('cmake' 'gtest' 'ninja' 'qt5-tools')
groups=('deepin-extra')
source=("https://github.com/linuxdeepin/deepin-movie-reborn/archive/$pkgver/$pkgname-$pkgver.tar.gz"
        $pkgname-dtkgui.patch::https://github.com/linuxdeepin/deepin-movie-reborn/commit/adbcf2f754f74947f32546f40d488001d34f3051.patch
        $pkgname-pie-ldflags.patch::https://github.com/linuxdeepin/deepin-movie-reborn/pull/352.patch)
sha512sums=('080cf178d78484ce2fed76a99871c0ced8be94f4748ad2bb84606ca50c8d0e90b1296dc6d03689149cd39fb6628e3d2c0ec6da5786a82f31e4256fc06ded0c30'
            '30fb17d6ba01fb2fc554a54d3106a943f5026b09153b07ad19d448bd1ead0132a829f4cf01fc074c0cd76a5b81a986c5829c71c6c7e75af6e9fdad02e8d05eb1'
            'c6b02928c312dcd186df95f2b7dc62709c8248dfe05e296f2648af2bb60a3287064555ca71108e6868707b4e8e1399fc1556c61401c8872202a577b8c6cfd690')

prepare() {
  cd deepin-movie-reborn-$pkgver
  patch -Np1 -i ../$pkgname-dtkgui.patch
  patch -Np1 -i ../$pkgname-pie-ldflags.patch
}

build() {
  cd deepin-movie-reborn-$pkgver
  export CXXFLAGS+=' -fpermissive'
  cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release -DVERSION=$pkgver .
  ninja
}

package() {
  cd deepin-movie-reborn-$pkgver
  DESTDIR="$pkgdir" ninja install
}
